package com.achang.achangmall.product.web;

import com.achang.achangmall.product.service.SkuInfoService;
import com.achang.achangmall.product.vo.SkuItemVo;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/******
 @author 阿昌
 @create 2021-10-15 21:18
 *******
 */
@Controller
public class ItemController {


    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * 展示当前sku的详细
     */
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model){
        SkuItemVo vo = skuInfoService.item(skuId);

        model.addAttribute("item",vo);
        return "item";
    }



}
